﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication2.Model
{
    class Keahlian
    {

        int id;
        int id_karyawan;
        int id_layanan;

        public Keahlian()
        {

        }

        public Keahlian(int _Id_Karyawan)
        {
            Database db = new Database();
            DataSet ds = new DataSet();
            DataTable dt = new DataTable();
            string sql = "SELECT * FROM keahlian WHERE id_karyawan = '" + _Id_Karyawan + "'";

            db.Open();
            ds = db.ExecuteQuery(sql);
            dt = ds.Tables[0];
            DataRow dr = dt.Rows[0];

            id = (int)dr[0];
            id_karyawan = (int)dr[1];
            id_layanan = (int)dr[2];

            db.Close();
        }

        public ArrayList daftarKeahlian(int _id_layanan)
        {
            return null;
        }

        public void addKeahlian()
        {
            Database db = new Database();
            string sql = "INSERT INTO keahlian(id_karyawan, id_keahlian) VALUES ('" + id_karyawan.ToString() + "','" + id_layanan.ToString() + "')";
            db.Open();
            db.ExecuteNonQuery(sql);
            db.Close();

        }

        public void updateKeahlian()
        {
        }

        public void deleteKeahlian()
        {
        }

    }
}
